package dialog;

import android.app.Dialog;
import android.content.Context;
import android.os.Bundle;
import android.view.View;
import android.view.Window;
import android.widget.LinearLayout;
import android.widget.TextView;

import com.example.zx.theline.R;

import GsonBean.CheckInfoBean;
import GsonBean.CheckPlanBean;
import base.BaseDialog;

/**
 * Created by zx on 2017/3/15.
 * 查看正式日计划详情
 */

public class ZsrjhChaKanDialog extends BaseDialog {

    //施工监护模块 日计划详细信息dialog
    TextView ydbh, rjhh, lb, rqsj1, rqsj2, rqsj3, xmmc,
            sgnr, sgjx, blfh, aqfx, fxcs, sgdw, fzr1, jldw, fzr2, jsdw,
            cwzd, ddt, sgdxjz, sbgldw, qtdw, shcs, xmzgbm, back;

    LinearLayout xlxb;

    CheckInfoBean mCheckInfoBean;

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.dialog_checkinfo);
        InitView();
        InitData();
        InitListen();
    }

    protected void InitView() {
        ydbh = (TextView) findViewById(R.id.ydbh);
        rjhh = (TextView) findViewById(R.id.rjhh);
        lb = (TextView) findViewById(R.id.lb);
        rqsj1 = (TextView) findViewById(R.id.rqsj1);
        rqsj2 = (TextView) findViewById(R.id.rqsj2);
        rqsj3 = (TextView) findViewById(R.id.rqsj3);
        xmmc = (TextView) findViewById(R.id.xmmc);
        sgnr = (TextView) findViewById(R.id.sgnr);
        sgjx = (TextView) findViewById(R.id.sgjx);
        blfh = (TextView) findViewById(R.id.blfh);
        aqfx = (TextView) findViewById(R.id.aqfx);
        fxcs = (TextView) findViewById(R.id.fxcs);
        sgdw = (TextView) findViewById(R.id.sgdw);
        fzr1 = (TextView) findViewById(R.id.fzr1);
        jldw = (TextView) findViewById(R.id.jldw);
        fzr2 = (TextView) findViewById(R.id.fzr2);
        jsdw = (TextView) findViewById(R.id.jsdw);
        cwzd = (TextView) findViewById(R.id.cwzd);
        ddt = (TextView) findViewById(R.id.ddt);
        sgdxjz = (TextView) findViewById(R.id.sgdxjz);
        sbgldw = (TextView) findViewById(R.id.sbgldw);
        qtdw = (TextView) findViewById(R.id.qtdw);
        shcs = (TextView) findViewById(R.id.shcs);
        xmzgbm = (TextView) findViewById(R.id.xmzgbm);
        back = (TextView) findViewById(R.id.back);
        xlxb= (LinearLayout) findViewById(R.id.xlxb);



    }

    @Override
    protected void InitData() {
        setData();
    }

    protected void InitListen() {
        back.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View v) {

                dismiss();
            }
        });
    }


    public ZsrjhChaKanDialog(Context context, CheckInfoBean mCheckInfoBean) {
        super(context);
        this.mCheckInfoBean = mCheckInfoBean;
    }
    public ZsrjhChaKanDialog(Context context) {
        super(context);
    }

    public void setData(){
        ydbh.setText(mCheckInfoBean.getInfo().getYdbh());
        rjhh.setText(mCheckInfoBean.getInfo().getBh());
        lb.setText(mCheckInfoBean.getInfo().getLb());
        rqsj1.setText(mCheckInfoBean.getInfo().getSgrq());
        rqsj2.setText(mCheckInfoBean.getInfo().getSgsjks());
        rqsj3.setText(mCheckInfoBean.getInfo().getSgsjjs());
        xmmc.setText(mCheckInfoBean.getInfo().getXmmc());
        sgnr.setText(mCheckInfoBean.getInfo().getNrmc());
        sgjx.setText(mCheckInfoBean.getInfo().getJxmc());
        blfh.setText(mCheckInfoBean.getInfo().getBlfhmc());
        aqfx.setText(mCheckInfoBean.getInfo().getAqfxmc());
        fxcs.setText(mCheckInfoBean.getInfo().getAqfxcsmc());
        sgdw.setText(mCheckInfoBean.getInfo().getSgdw());
        fzr1.setText(mCheckInfoBean.getInfo().getSgdwfzr());
        jldw.setText(mCheckInfoBean.getInfo().getJldw());
        fzr2.setText(mCheckInfoBean.getInfo().getJldwfzr());
        jsdw.setText(mCheckInfoBean.getInfo().getJsdw());
        cwzd.setText(mCheckInfoBean.getInfo().getCwzd());
        ddt.setText(mCheckInfoBean.getInfo().getDdt());
        sgdxjz.setText(mCheckInfoBean.getInfo().getSgdxjz());
        sbgldw.setText(mCheckInfoBean.getInfo().getSbgldw());
        qtdw.setText(mCheckInfoBean.getInfo().getQtdw());
        shcs.setText(mCheckInfoBean.getInfo().getShcs());
        xmzgbm.setText(mCheckInfoBean.getInfo().getXmzgbm());
        //动态添加多条线名view
        for (CheckInfoBean.InfoBean.XlxbListBean mXlxbListBean:mCheckInfoBean.getInfo().getXlxbList()
                ) {
            TextView xm;
            TextView dd;
            TextView hb;
            TextView lc;

            View view=View.inflate(getContext(),R.layout.xlxb,null);
            xm= (TextView) view.findViewById(R.id.xm);
            dd= (TextView) view.findViewById(R.id.dd);
            hb= (TextView) view.findViewById(R.id.hb);
            lc= (TextView) view.findViewById(R.id.lc);
            xm.setText(mXlxbListBean.getXlmc());
            dd.setText(mXlxbListBean.getSgdd());
            hb.setText(mXlxbListBean.getXbmc());
            lc.setText(mXlxbListBean.getLic());
            xlxb.addView(view);
        }

    }
}
